<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<header class="site-header" th:fragment="topBar(resCategoryModel,loginFlag,resUser)">
    <div class="container">
        <div class="navbar">
            <div class="logo-wrapper">
                <a href="/">
                    <img class="logo regular tap-logo" src="/static/images/logo.png" alt="资源基地">
                </a>
            </div>
            <div class="sep"></div>
            <head th:insert="common/nav::navBar(${resCategoryModel})"/>
            <div class="main-search">
                <form class="search-form inline" method="get" action="/web/search.html" name="searchFormOne"  onsubmit="return searchFormOneSubmit();">
                    <input type="search" class="search-field inline-field" placeholder="输入关键词，回车..." autocomplete="off" value=""  name="keywords">
                    <button type="submit" class="search-submit"><i class="mdi mdi-magnify"></i></button>
                    <div class="search-close navbar-button"><i class="mdi mdi-close"></i></div>
                </form>
                <script>
                    function searchFormOneSubmit() {
                        if (searchFormOne.keywords.value == "") {
                            layer.msg('输入关键词搜索！', {time: 1500, icon: 5});
                            searchFormOne.keywords.focus();
                            return false;
                        }
                        return true;
                    }
                </script>
            </div>
            <div class="actions">
                <!-- user -->
                <div class="header-dropdown header__group" th:if="${not loginFlag}">
                    <!-- 登录前 start -->
                    <div class="login-btn navbar-button">
                        <i class="mdi mdi-account"></i>
                        <a href="/to/login.html">登录</a>
                    </div>
                    <!-- 登录前 end-->
                </div>
                <div class="header-dropdown header__group header__group_user header__style_user" th:if="${loginFlag}">
                    <div class="header__cat">
                        <a class="user-pbtn" href="/person/info.html">
                            <img class="avatar avatar-96 photo qq" height="96" width="96"
                                 th:src="${#strings.isEmpty(resUser?.userImg)?'/static/images/dfboy.png':resUser?.userImg}"/>
                            <span>[[${resUser?.userName}]]</span>
                        </a>
                    </div>
                    <div class="header__dropdown">
                        <div class="header-box">
                            <div class="refresh-header-top">
                                <div class="header-top">
                                    <img th:src="${#strings.isEmpty(resUser?.userImg)?'/static/images/dfboy.png':resUser?.userImg}"
                                         class="avatar avatar-96 photo qq" height="96" width="96">
                                    <div >
                                        <span>
                                            <a class="user-names" href="/person/info.html">[[${resUser?.userName}]]</a>
                                            <i class="wp wp-VIP" th:if="${resUser?.userType==0}">普通会员</i>
                                            <i class="wp wp-VIP" th:if="${resUser?.userType==-1}">管理员</i>
                                            <i class="wp wp-VIP" th:if="${resUser?.userType==1}">白银会员</i>
                                            <i class="wp wp-VIP" th:if="${resUser?.userType==2}">黄金会员</i>
                                            <i class="wp wp-VIP" th:if="${resUser?.userType==3}">钻石会员</i>
                                        </span>
                                        <p th:if="${resUser?.userType==-1}">永久生效</p>
                                        <p th:if="${resUser?.userType==1}">2021-09-23 至 2021-09-23</p>
                                        <p th:if="${resUser?.userType==2}">2021-09-23 至 2021-09-23</p>
                                        <p th:if="${resUser?.userType==3}">2021-09-23 至 2021-09-23</p>
                                    </div>
                                    <a href="/web/logout.html" class="logout">退出</a>
                                </div>
                            </div>
                            <div class="header-bottom">
                                <ul>
                                    <li><a target="_blank" href="/person/collection.html"><i class="ico_1"></i>我的收藏</a></li>
                                    <li><a target="_blank" href="/person/downres.html"><i class="ico_2"></i>我的资源</a></li>
                                    <li><a target="_blank" href="/person/userinfo.html"><i class="ico_3"></i>安全中心</a></li>
                                    <li><a target="_blank" href="/person/mymoney.html"><i class="ico_4"></i>我的积分</a></li>
                                    <li><a target="_blank" href="/person/reportDetail.html"><i class="ico_5"></i>我要投稿</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- user end -->
                <div class="search-open navbar-button"><i class="mdi mdi-magnify"></i></div>
                <div class="tap-dark navbar-button"><i class="mdi mdi-brightness-4"></i></div>
                <div class="burger"></div>
            </div>
        </div>
    </div>
</header>
</html>
